#include "process.h"
#include <stdio.h>
#include<unistd.h>
//回调函数
typedef void (*callback_t)(double total , double current);

double total = 2024.0;
double speed = 1.0;

void download (callback_t cd){
    double current = 0;
    while(current <= total)
    {
        cd(total,current);
        // 下载代码
        usleep(3000); // 充当下载数据
        current += speed;
    }
    printf("\ndownload %.2lfMB Done\n", current);
}


void upload (callback_t cd){
    double current = 0;
    while(current <= total)
    {
        cd(total,current);
        // 下载代码
        usleep(3000); // 充当下载数据
        current += speed;
    }
    printf("\nupwnload %.2lfMB Done\n", current);
}

int main(){
    download(FlushProcess);
    download(FlushProcess);
    upload(FlushProcess);
    return 0;
}
